#!/usr/bin/env python

class ToolBarToolBase(object):
    '''ToolBarToolBase class
    
    @author Julot <andy.julot@gmail.com>
    @since Thursday, February 16, 2012. 04:59 PM'''
    
    _parent = None
    
    def __init__(self, parent, bitmap, shortHelpString, longHelpString):
        self._parent = parent
        self._tool = parent.AddTool(-1, bitmap=bitmap,
                                    shortHelpString=shortHelpString,
                                    longHelpString=longHelpString)
    
    def enable(self, enabled=True):
        self._parent.EnableTool(self._tool.Id, enabled)
    
    def disable(self, disabled=True):
        self._parent.EnableTool(self._tool.Id, not disabled)
    
    @property
    def tool(self):
        return self._tool
    